package chapter21;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2019/2/25 19:11
 */
interface B<T> {
}

class C {
}

class A implements B<C> {
}

class D<T> {
}

class E extends D<C> {

}

public class GenericClassTest2 {
    public static void main(String[] args) {
        A a = new A();
        Type[] types = a.getClass().getGenericInterfaces();
        for (Type type : types) {
            System.out.println(type);
        }

        ParameterizedType type = (ParameterizedType) E.class.getGenericSuperclass();
        for (Type actual : type.getActualTypeArguments()) {
            System.out.println(actual);
        }
    }
}
